import os
import shutil


def clear__pycache__(filepath):
    '''
    清理中间文件夹__pycache__
    '''
    files = os.listdir(filepath)
    for fd in files:
        cur_path = os.path.join(filepath, fd)
        if os.path.isdir(cur_path):
            if fd == '__pycache__':
                shutil.rmtree(cur_path)
            else:
                clear__pycache__(cur_path)


if __name__ == "__main__":
    clear__pycache__('./')